package com.jf.cloud.combo.task;

import com.jf.cloud.combo.service.ComboService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author zz
 * @date 2022/9/2 17:35
 * 套餐定时任务
 */
@Component
public class ComboTask {

    @Autowired
    private ComboService comboService;

    /**
     * 套餐活动结束，修改套餐状态、套餐商品项状态、套餐商品sku项状态
     */
    @XxlJob("activityFinishAndProdChange")
    public void activityFinishAndProdChange(){
        XxlJobHelper.log("套餐结束，修改套餐状态。。。");
        // 获取活动结束，需要改变套餐状态
        comboService.comboEndOperation();
    }

    @XxlJob("enableCombo")
    public void enableCombo(){
        XxlJobHelper.log("开启到了活动时间未开启的套餐活动。。。");
        comboService.enableCombo();
    }
}
